/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.restaurant.domain;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

import org.springframework.context.annotation.Lazy;

/**
 *
 * @author root
 */
@Entity
@Table(name = "bill")
@XmlRootElement(name="bill")  
@NamedQueries({
    @NamedQuery(name = "Bill.findAll", query = "SELECT b FROM Bill b"),
    @NamedQuery(name = "Bill.findByBillID", query = "SELECT b FROM Bill b WHERE b.billID = :billID"),
    @NamedQuery(name = "Bill.findByDescription", query = "SELECT b FROM Bill b WHERE b.description = :description"),
    @NamedQuery(name = "Bill.findByTotalamount", query = "SELECT b FROM Bill b WHERE b.totalamount = :totalamount"),
    @NamedQuery(name = "Bill.findByDiscountamount", query = "SELECT b FROM Bill b WHERE b.discountamount = :discountamount"),
    @NamedQuery(name = "Bill.findByDatetime", query = "SELECT b FROM Bill b WHERE b.datetime = :datetime"),
    @NamedQuery(name = "Bill.findByAmountreceived", query = "SELECT b FROM Bill b WHERE b.amountreceived = :amountreceived"),
    @NamedQuery(name = "Bill.findByAmountrefunded", query = "SELECT b FROM Bill b WHERE b.amountrefunded = :amountrefunded"),
    @NamedQuery(name = "Bill.findByIsprinted", query = "SELECT b FROM Bill b WHERE b.isprinted = :isprinted")})
public class Bill implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "BillID")
    private Long billID;
    @Column(name = "description")
    private String description;
    @Column(name = "totalamount")
    private Double totalamount;
    @Column(name = "discountamount")
    private Double discountamount;
    @Column(name = "datetime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datetime;
    @Column(name = "amountreceived")
    private Long amountreceived;
    @Column(name = "amountrefunded")
    private Long amountrefunded;
    @Column(name = "isprinted")
    private Boolean isprinted;
    @JoinColumn(name = "retaildetails_RetailShopID", referencedColumnName = "RetailShopID")
    @ManyToOne(optional = false)
    private Retaildetails retaildetails;
    @JoinColumn(name = "customertransaction_CustomertransactionID", referencedColumnName = "CustomertransactionID")
    @ManyToOne(optional = false)
    private Customertransaction customertransaction;
    @JoinColumn(name = "tableorder_TableorderID", referencedColumnName = "TableorderID")
    @ManyToOne(optional = false)
    private Tableorder tableorder;

    public Bill() {
    }

    public Bill(Long billID) {
        this.billID = billID;
    }

    public Long getBillID() {
        return billID;
    }

    public void setBillID(Long billID) {
        this.billID = billID;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Double getTotalamount() {
        return totalamount;
    }

    public void setTotalamount(Double totalamount) {
        this.totalamount = totalamount;
    }

    public Double getDiscountamount() {
        return discountamount;
    }

    public void setDiscountamount(Double discountamount) {
        this.discountamount = discountamount;
    }

    public Date getDatetime() {
        return datetime;
    }

    public void setDatetime(Date datetime) {
        this.datetime = datetime;
    }

    public Long getAmountreceived() {
        return amountreceived;
    }

    public void setAmountreceived(Long amountreceived) {
        this.amountreceived = amountreceived;
    }

    public Long getAmountrefunded() {
        return amountrefunded;
    }

    public void setAmountrefunded(Long amountrefunded) {
        this.amountrefunded = amountrefunded;
    }

    public Boolean getIsprinted() {
        return isprinted;
    }

    public void setIsprinted(Boolean isprinted) {
        this.isprinted = isprinted;
    }

    public Retaildetails getRetaildetails() {
        return retaildetails;
    }

    public void setRetaildetails(Retaildetails retaildetails) {
        this.retaildetails = retaildetails;
    }

    public Customertransaction getCustomertransaction() {
        return customertransaction;
    }

    public void setCustomertransaction(Customertransaction customertransaction) {
        this.customertransaction = customertransaction;
    }

    public Tableorder getTableorder() {
        return tableorder;
    }

    public void setTableorder(Tableorder tableorder) {
        this.tableorder = tableorder;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (billID != null ? billID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Bill)) {
            return false;
        }
        Bill other = (Bill) object;
        if ((this.billID == null && other.billID != null) || (this.billID != null && !this.billID.equals(other.billID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.restaurant.domain.Bill[billID=" + billID + "]";
    }

}
